package com.attilax.order;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

import aaaCfg.IocX4casher;

import com.attilax.db.DBX;
import com.attilax.formatter.SqlFormatter;
import com.attilax.io.filex;
import com.google.inject.Inject;

public class OrderService extends absService {

	public static void main(String[] args) {
		final long time_intFmt = new Date().getTime() / 1000;
		System.out.println(time_intFmt);
		OrderService os = IocX4casher.getBean(OrderService.class);
		os.insert(new HashMap() {
			{
				this.put("good_amount", 12.50);
				this.put("add_time", time_intFmt);
				this.put("confirm_time", time_intFmt);
				this.put("order_sn",filex.getUUidName());
			}
		});
		System.out.println("--f");
	}

	@Inject
	DBX dx;

	public int insert(Map order) {
		String sql = "insert into ecs_order_info(order_sn,order_status,shipping_status,pay_status,goods_amount,add_time,confirm_time,agency_id,inv_type,tax,discount)values('@order_sn@',1,1,1,@good_amount@,@add_time@,@confirm_time@,0,0,0,0) ";

		sql = SqlFormatter.exe(sql, order);
		System.out.println(sql);
		// DBX IocX4casher.getBean(DBX.class)
		dx.execSql(sql);
		return 0;

	}

}
